package com.qidian.buy.goods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qidian.buy.common.pojo.BuyResult;
import com.qidian.buy.goods.mapper.ItemSpecificationMapper;
import com.qidian.buy.pojo.ItemSpecification;
import com.qidian.buy.pojo.ItemSpecificationItem;
import com.qidian.buy.goods.mapper.ItemSpecificationItemMapper;
import com.qidian.buy.goods.service.IItemSpecificationItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.catalina.webresources.WarResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 戴着假发的程序员
 * @since 2024-07-17 09:36:01
 */
@Service
public class ItemSpecificationItemServiceImpl extends ServiceImpl<ItemSpecificationItemMapper, ItemSpecificationItem> implements IItemSpecificationItemService {

    @Autowired
    private ItemSpecificationItemMapper speItemMmapper;

    @Override
    public BuyResult saveSpeItem(ItemSpecificationItem speItem) {
        return BuyResult.isSuccess(speItemMmapper.insert(speItem));
    }

    @Override
    public BuyResult listSpeItem(Long speId) {
        QueryWrapper<ItemSpecificationItem> wrapper = new QueryWrapper<>();
        wrapper.eq("spe_id",speId);
        return BuyResult.success(speItemMmapper.selectList(wrapper));
    }
}
